package com.hcb.logsdk.socketio.socket;


import android.util.Log;

import com.hcb.logsdk.socketio.listener.IConstants;
import com.hcb.logsdk.util.C;

/**
 * @author silencezwm on 2017/8/25 上午11:12
 * @email silencezwm@gmail.com
 * @description AppSocket
 */
public class AppSocket extends BaseSocket {

    private static volatile AppSocket INSTANCE = null;

    public static AppSocket getInstance() {
        if (INSTANCE == null) {
//            throw new NullPointerException("must first call the build() method");
            return null;
        }
        return INSTANCE;
    }

    public static AppSocket init(Builder builder) {
        return new AppSocket(builder);
    }

    private AppSocket(Builder builder) {
        super(builder);
        INSTANCE = this;
    }





    public void sendLog2Server(String event,String msg) {

        Log.i("PushLogService","是否发送日志：----------"+ C.START_SEND_LOG);

        if(!C.START_SEND_LOG) return;

        if(mSocket!=null && msg!=null){
            mSocket.emit(event, msg);
        }
    }


}
